package test;

/**
 * 描述：
 *      单例模式
 * @author hl
 * @version 1.0
 * @date 2020/10/30 18:38
 */
public class SingleTon {
    private static volatile SingleTon instance = null;
    private SingleTon(){}
    public static SingleTon getInstance(){
        if (instance == null) {
            synchronized (SingleTon.class){
                if (instance == null) {
                    instance = new SingleTon();
                }
            }
        }
        return instance;
    }
}
